package com.ckzp.jfinal.base.csrf;

import com.jfinal.core.Const;
import com.jfinal.core.Controller;

/**
 * Created by 51594 on 2022/8/11.
 */
public class TokenService {
    /**
     * 创建token
     *
     * @param c
     */
    public void createToken(Controller c) {
        CsrfTokenManager.createToken(c, Const.DEFAULT_TOKEN_NAME, Const.DEFAULT_SECONDS_OF_TOKEN_TIME_OUT);
    }

    /**
     * 验证token
     *
     * @param c
     */
    public boolean validateToken(Controller c) {
        return CsrfTokenManager.validateToken(c, Const.DEFAULT_TOKEN_NAME);
    }
}
